package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.mappers.PeachbossomMapper;
import com.tanhua.model.domain.Peachbossom;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class PeachbossomApiImpl implements PeachbossomApi{

    @Autowired
    private PeachbossomMapper peachbossomMapper;

    @Override
    public List<Peachbossom> peachblossomjs() {
        Wrapper<Peachbossom> query = new QueryWrapper<>();
        List<Peachbossom> peachbossoms = peachbossomMapper.selectList(query);
        return peachbossoms;
    }

    @Override
    public void save(Long userId, String url) {
        Peachbossom peachbossom = new Peachbossom();
        peachbossom.setUserid(userId);
        peachbossom.setSoundUrl(url);
        peachbossomMapper.insert(peachbossom);
    }
}
